/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.muni.fi.pa165.sportclubmanager.dto;

import cz.muni.fi.pa165.sportclubmanager.entity.Users;

/**
 *
 * @author juro
 */
public class UserDTOMapping {
    public static Users toEntity(UserDTO userDTO){
        if(userDTO == null) return null;
        Users user = new Users();
        user.setName(userDTO.getName());
        user.setPassword(userDTO.getPassword());
        user.setMyRole(userDTO.getRole());
        return user;
    }
    
    public static UserDTO toDTO(Users user){
        if(user == null) return null;
        UserDTO userDTO = new UserDTO();
        userDTO.setName(user.getName());
        userDTO.setPassword(user.getPassword());
        userDTO.setRole(user.getMyRole());
        return userDTO;
    }
}
